<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        
        // 字符替换
        var str = 'apple-pie';
        while(str.indexOf('p')!=-1){
            str = str.replace('p','b');
        }
        console.log(str);

        // 字符串转为数组
        var str1 = 'red&pink&blue';
        console.log(str1.split('&'));


 
    </script>
</head>
<body>
    
</body>
</html>